<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="css/tabla.css" rel="stylesheet" type="text/css">
<title>Mostrar Noticias</title>
<script src="js/noticia.js" language="JavaScript" charset="UTF-8"> </script>
<%@ page import="com.guarderia.bean.*,java.util.*,com.guarderia.utils.UtilidadesGenerales" %>
<%!
ArrayList noticias;
String parImpar;
NoticiaBean noticia;
%>
<%
	noticias = session.getAttribute("noticias") != null ? (ArrayList)session.getAttribute("noticias") : new ArrayList();
%>
</head>
<body>
<div id="texto">
	<form id="formularioNoticia" method="post" action="Controlador">
	<input type="hidden" name="numeroNoticia"/>
	<input type="hidden" name="opcion"/>
	<table summary="Tabla de datos de la clase"  class="tablaDatos">
		<caption>Noticias</caption>
		<thead>
			<tr>
				<th scope="col">Titulo</th>
				<th scope="col">Resumen</th>
				<th scope="col">Habilitado</th>
				<th scope="col">Fecha</th>
				<th scope="col"></th>
			</tr>
		</thead>	
		<tfoot>
			<tr>
				<th scope="row">Total</th>
				<td colspan="4"><%=noticias.size()%> noticias</td>
			</tr>
		</tfoot>
		<tbody class="tablaDatosCuerpo">
			<%
			parImpar = "";
			for (int i=0; i<noticias.size();i++){
				noticia = (NoticiaBean)noticias.get(i);
				if (i % 2 == 1) parImpar ="class='odd'";
				else parImpar = "";
			%>
			<tr <%=parImpar%>>
				<td><%=noticia.getTitulo()%></td>
				<td><%=noticia.getResumen()%></td>
				<td><%=noticia.getHabilitado()%></td>
				<td><%=UtilidadesGenerales.convertirGregorianCalendarEnString(noticia.getFecha())%></td>
				<td><a href="javascript:ventanaModificarNoticia('<%=i%>')">Modificar</a></td>
			</tr>
			<%} %>
		</tbody>
	</table>
	</form>
	<div class="capa_boton_centrado">
		<input type="button" value="Volver" onclick="javascript:volver2('formularioNoticia');">
	</div>
</div>
</body>
</html>